import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:get/get_navigation/src/root/get_material_app.dart';
import 'package:get/get_navigation/src/routes/transitions_type.dart';

import 'app/config/app_environment.dart';
import 'app/routes/app_pages.dart';

void main() {
  //配置透明的状态栏
  SystemUiOverlayStyle systemUiOverlayStyle =
      const SystemUiOverlayStyle(statusBarColor: Colors.transparent);
  SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  AppEnvironment.initialize(AppEnv.debug);
  runApp(ScreenUtilInit(
      designSize: const Size(375, 812), //设计稿的宽度和高度 px
      minTextAdapt: true,
      splitScreenMode: true,
      builder: (context, child) {
        return GetMaterialApp(
          debugShowCheckedModeBanner: false,
          title: "Application",
          //配置主题
          theme: ThemeData(primarySwatch: Colors.grey),
          initialRoute: AppPages.INITIAL,
          //配置ios动画
          defaultTransition: Transition.rightToLeft,
          getPages: AppPages.routes,
          // 配置 SmartDialog
          navigatorObservers: [FlutterSmartDialog.observer],
          builder: FlutterSmartDialog.init(),
        );
      }));
}
